demos/testpixbuf-scale.c: Use accessor functions to access GtkWidget
authorJavier Jardón <jjardon@gnome.org>
Sun, 15 Aug 2010 22:36:11 +0000 (00:36 +0200)
committerJavier Jardón <jjardon@gnome.org>
Sun, 22 Aug 2010 16:28:55 +0000 (18:28 +0200)
demos/testpixbuf-scale.c

index 6d335e1cc0be3348253ecbd537ce17b695be661b..50244e4f725075da02b7e12bec3e2e2c35d8d242 100644 (file)
@@ -34,18 +34,21 @@ overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
 gboolean
 expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 {
+  GtkAllocation allocation;
   GdkPixbuf *dest;
   cairo_t *cr;
 
-  gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
-  
+  gdk_window_set_back_pixmap (gtk_widget_get_window (widget),
+                              NULL, FALSE);
+
   dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
 
+  gtk_widget_get_allocation (widget, &allocation);
   gdk_pixbuf_composite_color (pixbuf, dest,
                              0, 0, event->area.width, event->area.height,
                              -event->area.x, -event->area.y,
-                             (double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf),
-                             (double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
+                              (double) allocation.width / gdk_pixbuf_get_width (pixbuf),
+                              (double) allocation.height / gdk_pixbuf_get_height (pixbuf),
                              interp_type, overall_alpha,
                              event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);